import request from '@/utils/request'

export function getRoles(params) {
  return request({
    url: '/sys/role',
    method: 'get',
    'params': params
  })
}

export function deleteRolesById(id) {
  return request({
    url: '/sys/role/' + id,
    method: 'delete'
  })
}

export function addRole(data) {
  return request({
    url: '/sys/role',
    method: 'post',
    data
  })
}

export function updateRole(data) {
  return request({
    url: `/sys/role/${data.id}`,
    method: 'put',
    data
  })
}

export function getDetailRole(data) {
  return request({
    url: `/sys/role/${data.id}`,
    method: 'get',
    data
  })
}

export function assignRoles(data) {
  return request({
    url: '/sys/user/assignRoles',
    method: 'put',
    data
  })
}

export function getRolesDetail(id) {
  return request({
    url: '/sys/role/' + id,
    method: 'get'
  })
}

export function assignPermission(data) {
  return request({
    url: '/sys/role/assignPrem',
    method: 'put',
    data
  })
}
